import React from 'react'
import { connect } from 'react-redux'
import { MyState } from "../../type/router.d"
import * as actions from "../../store/modules/action"
import { bindActionCreators, Dispatch } from "redux"
import style from "./index.module.scss"
import { useHistory } from "react-router"

interface PROPS {
    arcData: any
    // history:any
    // ggetActDetailAction: (obj: any) => void
}
export const Righttop = (props: PROPS) => {
    const history = useHistory()
    return (
        <div className={style["detail-right"]}>
            <div className={style["detail-right-title"]}>
                <span>推荐阅读</span>
            </div>
            <div className={style["detail-right-content"]}>
                {props.arcData.length ? props.arcData.map((item: any, index: number) => {
                    return <p onClick={() => {
                        history.push(`/index/archiveDetails/${item.id}`);
                        // props.getActDetailAction(item)
                    }} key={index} className='rightp'>{item.title}</p>
                }) : "暂无数据"}
            </div>
        </div>
    )
}

const mapStateToProps = (state: MyState) => ({
    arcData: state.arcData
})

const mapDispatchToProps = (dispatch: Dispatch) => {
    return bindActionCreators(actions, dispatch)
}

export default connect(mapStateToProps, mapDispatchToProps)(Righttop)